<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12 footer navbar-inverse navbar-fixed-bottom">
			<p class="copyright">
				&copy;{{ site.time | date: '%Y' }} {{ site.name }}.
				ICP证：<a href="http://beian.miit.gov.cn/" target="_blank">{{ site.beian }}</a>
				<img src="/images/备案图标.png"/>
				<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode={{ site.zhejiangbeian }}"/>
					浙公网安备 {{ site.zhejiangbeian }}号
				</a>
				Powered by <a href="http://jekyllrb.com" target="_blank">Jekyll</a>,
				theme by <a href="https://github.com/scotte/jekyll-clean" target="_blank">Scott Emmons</a>
				under <a href="http://creativecommons.org/licenses/by/4.0/" target="_blank">Creative Commons Attribution</a>
			</p>
		</div>
	</div>
</div>
<script src="{{ site.baseurl }}/js/lib/bootstrap.viewer.min.js"></script>
<script type="text/javascript">
	var options = {
		theme : 'hand'
	};
	$(document).ready(function() {
		// 图片 http://bootstrap-viewer.leftso.com/#getting-started
		/* $('.viewer').bootstrapViewer();//The default image source file path is the src attribute of the img tag. */
		let content = $('.post-content')[0];
		let width = 600;
		if (content && content.length > 0) {
			width = $('.post-content')[0].clientWidth;
		}
		$('.post-content img').each((i, img) => {
			if (img.width > width) {
				img.width = width * .8;
			}
		})
		$('.post-content img').bootstrapViewer();
	});
</script>

<!-- 搜索 -->
<!-- script pointing to jekyll-search.js -->
<script src="{{ site.baseurl }}/js/lib/simple-jekyll-search/dest/simple-jekyll-search.min.js"></script>
<script type="text/javascript">
	function GetQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
		var r = decodeURI(window.location.search).substr(1).match(reg); //匹配目标参数
		if (r != null) return unescape(r[2]);
		return null; //返回参数值
	}
	(function() {
		window.simpleJekyllSearch = new SimpleJekyllSearch({
			searchInput : document.getElementById('search-input'),
			resultsContainer : document.getElementById('results-container'),
			json : '/search.json',
			templateMiddleware: function(prop, value, template) {
			  if (prop === 'tags') {
					let spanTags = [];
					value.trim().split(',').forEach(t=>{
						 spanTags.push('<span class="group-lable-min">' + t + '</span>')
					});
					return spanTags.join('');
			  }
			},
			searchResultTemplate : '<li><a href="{url}" title="{desc}">{title}</a>    {tags}</li>',
			noResultsText : '无搜索结果'
		});
		/* var q = GetQueryString('q');
		$('#search-input').val(q);
		simpleJekyllSearch.search(q); */
	})();
</script>

{% if site.markdownext == true %}
<!-- 时序图js -->
<script src="{{ site.baseurl }}/js/lib/bower-webfontloader/webfont.js" ></script>
<script src="{{ site.baseurl }}/js/lib/snap.svg/dist/snap.svg-min.js" ></script>
<script src="{{ site.baseurl }}/js/lib/underscore/underscore-min.js" ></script>
<script src="{{ site.baseurl }}/js/lib/js-sequence-diagrams/dist/sequence-diagram-min.js" ></script>
<!-- 流程图js -->
<script src="{{ site.baseurl }}/js/lib/raphael/raphael.min.js" ></script>
<script src="{{ site.baseurl }}/js/lib/flowchart/release/flowchart.min.js " ></script>
<script>
	// 时序图
	try {
		$("pre code.language-sequence").sequenceDiagram(options);
		$("pre code.language-sequence").parent().css('background-color', 'white');
	} catch (e) {}
	// 流程图
	$("pre code.language-flow").each(function(i, element) {
		var texts = $("pre code.language-flow").text().split('\n');
		var code = '';
		for (var i = 0; i < texts.length; i++) {
			var line = texts[i];
			code += line + '\n';
		}
		var diagram = flowchart.parse(code);
		$(element).html('');
		diagram.drawSVG(element);
	});
	$("pre code.language-flow").parent().css('background-color', 'white');
</script>
{% endif %}

{% if site.tag3dcloud == true %}
<!-- 3d云标签 -->
<script src="{{ site.baseurl }}/js/lib/tagcloud-1.1.1/dist/tagcloud.min.js"></script>
<script>
	(function() {
		// 开启渲染
		tagcloud({
			//参数名: 默认值
			selector : ".tagcloud", //元素选择器
			fontsize : 14, //基本字体大小
			radius : 80, //滚动半径
			mspeed : "normal", //滚动最大速度
			ispeed : "normal", //滚动初速度
			direction : 135, //初始滚动方向
			keep : true //鼠标移出组件后是否继续随鼠标滚动
		});
	})();
</script>
{% endif %}

{% if site.wordcloud2 == true %}
<!-- 词云 -->
<script src="{{ site.baseurl }}/js/lib/wordcloud2/wordcloud2.min.js"></script>
<script>
	(function() {
		var allTagStr = $('#wordcloud_all_tag').html().trim();
		if (allTagStr.startsWith(',')) {
			allTagStr = allTagStr.substr(1) ;
		}
		var tags = allTagStr.split(',');
		var map = {};
		for (var i = 0; i < tags.length; i++) {
			var tag = tags[i];
			if (tag) {
				if (map[tag]) {
					map[tag] += 1;
				} else {
					map[tag] = 1;
				}
			}
		}
		var list = [ [ 'foo', 12 ], [ 'bar', 6 ] ];
		list = [];
		for (var key in map) {
			list.push([ key, map[key] ]);
		}
		// 开启渲染
		WordCloud(document.getElementById('wordcloud_canvas'), {
			list : list,
			fontFamily : 'Microsoft Yahei',
			fontWeight : 'normal',
			backgroundColor : '#f5f5f5',
			gridSize: 8,
  			weightFactor: 16,
  			color: 'random-dark',
  			rotateRatio: 1
		});
	})();
</script>
{% endif %}

{% include disqus-counts.html %}
{% include analytics.html %}

<script>
// 标签切换更改标题
var titleTime,OriginTitile = document.title;
document.addEventListener('visibilitychange',
	function() {
		if (document.hidden) {
			document.title = '喔唷 崩溃啦! ' + OriginTitile;
			clearTimeout(titleTime);
		} else {
			document.title = '嗯哼 又好了~ ' + OriginTitile;
			titleTime = setTimeout(function() {
				document.title = OriginTitile;
			},2000);
		}
	});
// tag处理
$(document).ready(function() {
	$('.post-tags').each((i,p)=>{
		let spanTags = [];
		p.innerText.trim().split(',').forEach(t=>{
			 spanTags.push('<span class="group-lable">' + t + '</span>')
		});
		$(p).html(spanTags)
	});
	
	let tagDom = $('#page-tags');
	if (!tagDom) {
		return;
	}
	let tags = tagDom.text() && tagDom.text().trim();
	let spanTags = [];
	tags.split(',').forEach(t=>{spanTags.push('<span class="group-lable">' + t + '</span>')});
	tagDom.html(spanTags)
});
</script>

</body>
</html>
